import type { ConfigVO, ConfigForm, ConfigQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

// /**
//  * 查询干预规则配置列表
//  * @param params
//  * @returns 干预规则配置列表---不分页
//  */
// export function configListAll(params?: ConfigQuery) {
//   return requestClient.get<ConfigVO[]>('/business/intervention-rule/list-all', {
//     params,
//   });
// }

/**
 * 查询干预规则配置列表
 * @param params
 * @returns 干预规则配置列表---分页
 */
export function configList(params?: ConfigQuery) {
  return requestClient.get<PageResult<ConfigVO>>(
    '/business/intervention-rule/list',
    { params },
  );
}

/**
 * 导出干预规则配置列表
 * @param params
 * @returns 干预规则配置列表
 */
export function configExport(params?: ConfigQuery) {
  return commonExport('/business/intervention-rule/export', params ?? {});
}

/**
 * 查询干预规则配置详情
 * @param id id
 * @returns 干预规则配置详情
 */
export function configInfo(id: ID) {
  return requestClient.get<ConfigVO>(`/business/intervention-rule/${id}`);
}

/**
 * 新增干预规则配置
 * @param data
 * @returns void
 */
export function configAdd(data: ConfigForm) {
  return requestClient.postWithMsg<void>('/business/intervention-rule', data);
}

/**
 * 更新干预规则配置
 * @param data
 * @returns void
 */
export function configUpdate(data: ConfigForm) {
  return requestClient.putWithMsg<void>('/business/intervention-rule', data);
}

/**
 * 删除干预规则配置
 * @param id id
 * @returns void
 */
export function configRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/business/intervention-rule/${id}`);
}
